package war2100;

import java.net.URL;

import org.newdawn.slick.AppGameContainer;

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.StateBasedGame;

import TWLSlick.TWLStateBasedGame;

import war2100.game.states.*;

public class Game extends StateBasedGame {

	private Prototypes prototypes;
	private boolean mouse0Pressed;

	public Game(String name) {
		super(name);
	}
	
	@Override
	public void initStatesList(GameContainer gc) throws SlickException {
 
		addState(new MainMenuGameState());
 
		addState(new LobbyState());
		
		setPrototypes(new Prototypes(Prototypes.TYPE_GAME));
	}
 
	public static void main(String[] args) throws SlickException
    {
         AppGameContainer app = new AppGameContainer(new Game("War 2100 - Pre Alpha"));
 
         // Application properties
         app.setDisplayMode(800, 600, false);
         //app.setSmoothDeltas(true);
 
         app.start();
    }
	
	public Prototypes getPrototypes() {
		return prototypes;
	}
	
	public void setPrototypes(Prototypes prototypes) {
		this.prototypes = prototypes;
	}
	
	public boolean isMouse0Pressed() {
		return mouse0Pressed;
	}

	/*@Override
	protected URL getThemeURL() {
		return Game.class.getResource("simple.xml");
	}*/
	
}
/*
public class Game extends BasicGame {

	private State currentState;
	private Prototypes prototypes;
	private boolean mouse0Pressed;

	public Game(String title) {
		super(title);
	}

	@Override
	public void init(GameContainer gc) throws SlickException {
		setPrototypes(new Prototypes(Prototypes.TYPE_GAME));
		setCurrentState(new MainMenuState(this, gc));
	}

	@Override
	public void update(GameContainer gc, int delta) throws SlickException {
		mouse0Pressed = gc.getInput().isMousePressed(0);

		if (getCurrentState() != null) {
			getCurrentState().update(gc, delta);
		}
	}

	@Override
	public void render(GameContainer gc, Graphics g) throws SlickException {
		if (getCurrentState() != null) {
			getCurrentState().render(gc, g);
		}
	}

	public static void main(String[] args) {
		try {
			AppGameContainer app = new AppGameContainer(new Game("War 2100 - Pre Alpha"));
			app.start();
		}
		catch (SlickException e) {
			e.printStackTrace();
		}
	}

}*/